<?php defined('IN_ADMIN') or exit('No permission resources.');?>
<?php include $this->admin_tpl('header', 'admin');?>
<script type="text/javascript">
	window.top.$('#display_center_id').css('display','none');
</script>
<script>
    function change_color_over(title_id){
    	$("#"+title_id).css('color',"blue");
    }
    function change_color_out(title_id){
    	$("#"+title_id).css('color',"black");
    }
</script>
<div class="pad-lr-10">
<div id="searchid" style="">
<form name="searchform" action="" method="get" >
<input type="hidden" value="<?php echo ROUTE_M;?>" name="m">
<input type="hidden" value="<?php echo ROUTE_C;?>" name="c">
<input type="hidden" value="<?php echo ROUTE_A;?>" name="a">
<input type='hidden' name = 'status' value='<?php if($status=='unchecked'){echo 'unchecked';}else{echo '';}?>'>
<input type="hidden" value="1" name="search">
<input type="hidden" value="<?=$num?>" name="num">
<input type="hidden" value="<?php echo $pc_hash;?>" name="pc_hash">
<table width="100%" cellspacing="0" class="search-form">
    <tbody>
		<tr>
		<td>
		<div class="explain-col">
				
				<?php echo L('title');?>：<input name="title" type="text" value="<?php echo $_GET['title']?>" class="input-text" />
				<?php echo L('type')?>：
				<select name="catid" >
				<option value="0">请选择</option>
				<?php echo $select_categorys;?>
				</select>
				<!--<?php echo L('contestName')?>：
				<select name="contest_id" >
				<option value="0">请选择</option>
				<?php echo $categorys;?>
				</select>-->
				是否有正方图：<?php echo form::select(array('1'=>'是','2'=>'否'), $image_square, $str = 'name = "image_square"', '请选择');?>
				<input type="submit" name="search" class="button" value="<?php echo L('search');?>" />
	</div>
	<!-- <div class="explain-col" style="margin-top:5px;">
		绑定栏目：<?php echo form::select_category('category_content_'.$this->siteid,'','name="cate_id" id="cate_id"','请选择',0,-1);?>
				<a href="javascript:;" class="button" onclick="ajaxRelease(3);">发布</a>
	</div> -->
		</td>
		</tr>
    </tbody>
</table>
</form>
</div>
<form name="myform" action="?m=picture&c=picture&a=deleteAll&dosubmit=1" method="post" onsubmit="return confirm('<?php echo L('picture_info_delete')?>')">
<div class="table-list">
<table width="100%" cellspacing="0">
	<thead>
		<tr>
			<th  align="center" width="20"><input type="checkbox" value="" id="check_box" onclick="selectall('ids[]');"></th>
			<th align="center" width="20">ID</th>
			<th align="center" width="120"><?php echo L('title')?></th>
			<th align="center" width="70">图片数量</th>
			<th align="center" width="100"><?php echo L('type')?></th>
			<?php if($status=='unchecked'){?>
			<th align="center" width="100"><?php echo L('source_name')?></th>
			<?php }?>
			<th align="center" width="120"><?php echo L('image_smalls')?></th>
			<!-- <th align="center" width="70"><?php echo L('contestName')?></th> -->
			<th align="center" width="50">是否发布</th>
			<th align="center" width="120"><?php echo L('create_time')?></th>
			<th align="center" width="70">上次编辑者</th>
			<th align="center" width="150"><?php echo L('operations_manage')?></th>
		</tr>
	</thead>
<tbody>
<?php
if(!empty($picture_list)) {
	foreach($picture_list as $k=>$v) {
?>
    <tr>
		<td align="center"><input type="checkbox" value="<?php echo $v['id']?>" name="ids[]"></td>
		<td align="center"><?php echo $v['id']?></td>
		<td align="center"><a href="http://m.nsr.com.cn/xinsilu/v1/pictureNsr/showOneHtml/<?=$v['id']?>" id="title_<?php echo $v['id'];?>" target="_blank"  onmouseover="change_color_over('title_'+<?php echo $v['id'];?>)" onmouseout="change_color_out('title_'+<?php echo $v['id'];?>)" title="点击可预览：<?php echo $v['title'];?>图集"><?php echo $v['title']?></a></td>
		<td align="center"><?php echo '<strong>'.$v['pics'].'</strong>&nbsp;张';?></td>
		<td align="center"><?php echo $v['typeName']?$v['typeName']:'<font color="red">（未设置）</font>';?></td>
			<?php if($status=='unchecked'){?>
		<td align="center"><?php echo $v['source_name']?$v['source_name']:'<font color="red">（未设置）</font>';?></td>
			<?php }?>
		<td align="center"><?php if ($v['image_cover']){ ?><img src="<?php echo $v['image_cover'];?>" width="80"/><?php }else{echo '<font color="red">（未设置）</font>';}?></td>
		<!-- <td align="center"><?php echo $v['contestName']?$v['contestName']:'<font color="red">（未设置）</font>';?></td> -->
		<td align="center"><a href="javascript:;" onclick="is_publish_ajax(this,<?=$v['id']?>);" title="点击即可更改当前图集的发布、未发布状态"><?php echo $v['is_publish'] == 1?'<span style="color:green">发布</span>':'<span style="color:red">未发布</span>';?></a></td>
		<td align="center"><?php echo $v['create_time'];?></td>
		<td align="center"><?php echo $adminInfo[$v['updated_by']];?></td>
		<td align="center">
			<a href="?m=picture&c=picture&a=edit&id=<?php echo $v['id']?>&status=<?php if($status=='unchecked'){echo 'unchecked';}else{echo '';}?>" title="<?php echo L('edit')?>"><?php echo L('edit')?></a> | 
			<a href="?m=picture&c=picture&a=delete&id=<?php echo $v['id']?>&title=<?php echo $v['title'];?>" onClick="return confirm('确认要删除[<?php echo $v['title']?>]？')"><?php echo L('delete')?></a>
			<?php if($status!='unchecked'){?><!-- <a href="?m=picture&c=picture&a=show&id=<?php echo $v['id']?>&source_type=3"><?php echo L('show')?></a> --><?php }else{?> | <a href="?m=picture&c=picture&a=check_in&id=<?php echo $v['id']?>&source_type=2&title=<?php echo $v['title'];?>"><?php echo L('check_in')?></a><?php }?>
		</td>
    </tr>
<?php
	}
} else {
	echo "<tr><td colspan='".($status?11:10)."' style='color:red;font-size:18px;text-align:center;'><span>暂无数据！</span></td></tr>";
}
?>
</tbody>
</table>

<div class="btn">
<label for="check_box"><?php echo L('select_all')?>/<?php echo L('cancel')?></label> <input type="submit" class="button" name="dosubmit" value="<?php echo L('delete')?>"/>
<!-- <input type="button" class="button" value="--><?php //echo L('import_collection_points')?><!--" onclick="import_spider()" />-->
每页条数：
<select onchange="window.location='?m=<?php echo ROUTE_M;?>&c=<?php echo ROUTE_C;?>&a=<?php echo ROUTE_A;?>&pc_hash=<?php echo $_SESSION['pc_hash'];?>&num='+this.value">
	<option value="10" <?php if($num == 10){?>selected<?php }?> >10</option>
	<option value="15" <?php if($num == 15){?>selected<?php }?> >15</option>
	<option value="20" <?php if($num == 20){?>selected<?php }?> >20</option>
	<option value="30" <?php if($num == 30){?>selected<?php }?> >30</option>
	<option value="50" <?php if($num == 50){?>selected<?php }?> >50</option>
</select>
</div>

<div id="pages"><?php echo $pages?></div>
</div>
</form>
</div>
<script type="text/javascript">
	function edit(id, name) {
		window.top.art.dialog({id:'edit'}).close();
		window.top.art.dialog({title:'<?php echo L('edit')?> '+name+' ',id:'edit',iframe:'?m=picture&c=picture&a=edit&id='+id,width:'700',height:'350'}, function(){var d = window.top.art.dialog({id:'edit'}).data.iframe;var form = d.document.getElementById('dosubmit');form.click();return false;}, function(){window.top.art.dialog({id:'edit'}).close()});
	}
	function is_publish_ajax (obj,id){
		var is_publish = $(obj).children('span').html() == '发布'?1:0;
		$.ajax({
            type:"post",
            url:"?m=picture&c=picture&a=ajaxSourceLink&pc_hash=<?php echo $_SESSION['pc_hash'];?>",
            dataType: "json",
            data: {id:id,is_publish:is_publish},
            success:function(data){
            	if (data) {
            		if (is_publish == 1) {
						$(obj).html('<span style="color:red">未发布</span>');
					} else {
						$(obj).html('<span style="color:green">发布</span>');
					}
            	}
            }
        })
	}

</script>
</body>
</html>